# -*- coding:utf-8 -*-
from flask import Flask, render_template
from flask import request
import json

# 定义一个数组，模拟后端传来的数据
date = [
    {'user_id': 1,
     'user_name': 'Peter',
     'Chinese': 96,
     'English': 70,
     'Math': 73,
     'Physics': 84,
     'Chemistry': 75,
     'History': 85
     },
    {'user_id': 2,
     'user_name': 'James',
     'Chinese': 98,
     'English': 77,
     'Math': 73,
     'Physics': 55,
     'Chemistry': 95,
     'History': 75
     },
    {'user_id': 3,
     'user_name': 'Mary',
     'Chinese': 68,
     'English': 77,
     'Math': 68,
     'Physics': 75,
     'Chemistry': 85,
     'History': 75
     }
]


def grade_dateall():
    return date


def grade_date(user_id):
    # 接收传来的值
    user_id = request.args.get('user_id')
    # print(json.dumps(date[int(user_id) - 1]))
    return json.dumps(date[int(user_id) - 1])
